/*
 * Created by SharpDevelop.
 * User: Songwut Khamsuk
 * Date: 16/6/2552
 * Time: 14:40
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using System;
using System.IO;
using ICSharpCode.Core.Presentation;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;

namespace DreamShieldBinding
{
	/// <summary>
	/// Description of DreamShieldDisplayBinding.
	/// </summary>
	public class DreamShieldDisplayBinding : ISecondaryDisplayBinding
	{
		public bool ReattachWhenParserServiceIsReady {
			get {
				return false;
			}
		}
		
		public bool CanAttachTo(IViewContent content)
		{
			ITextEditorControlProvider textAreaControlProvider = content as ITextEditorControlProvider;
			if (textAreaControlProvider == null) {
				return false;
			}
			
			if (content.PrimaryFileName == null) {
				return false;
			}
			
			return Path.GetExtension(content.PrimaryFileName) == ".dscx";
		}
		
		public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)
		{
			return new IViewContent[]{new WpfViewer(viewContent.PrimaryFileName) };
		}
	}
}
